#include "Process.h"
#include "ActionToInput.h"
#include "Font\FontManager.h"
#include "InputManager.h"
#include "GraphicsManager.h"
#include "Base.h"


CProcess::~CProcess(void)
{
}

uint32 CProcess::RenderDebugInfo(CGraphicsManager *l_GraphicsManager, CFontManager *l_FontManager, float l_Fps)
{
	uint32 posY = 0;
	uint32 posX = 0;
	CInputManager *inputManager = CORE->GetInputManager();
    if (m_bRenderDebugInfo)
    {
		CInputManager* inputManager = CORE->GetInputManager();
		/*Vect2i mousePos;
		inputManager->GetPosition(IDV_MOUSE,mousePos);
		uint32 posX = m_PosRenderDebugInfo.x;*/
		/*float value;
		m_LerpAnimator1D.Update(0.f,value);
		posY =     (uint32)value;
		std::string info, shortInfo;
		CActionToInput* action2Input = CORE->GetActionToInput();*/

		posY+=l_FontManager->DrawDefaultText(posX,posY,colWHITE,"_________________PROCESS INFORMATIONl______________" );
		//action2Input->GetActionInfo(ACTION_PROCESS_INFO, info, shortInfo);
		//posY+=l_FontManager->DrawDefaultText(posX,posY,colWHITE,"- Press %s to show/hide this information", shortInfo.c_str() );
		posY+=l_FontManager->DrawDefaultText(posX,posY,colWHITE,"- Press F1 to show/hide this information");
		//action2Input->GetActionInfo(ACTION_SCREENSHOT, info, shortInfo);
		//posY+=l_FontManager->DrawDefaultText(posX,posY,colWHITE,"- Press %s to save in a file the current screenshot", shortInfo.c_str() );
		//action2Input->GetActionInfo(ACTION_LOGGER, info, shortInfo);
		//posY+=l_FontManager->DrawDefaultText(posX,posY,colWHITE,"- Press %s to save in a file the current logger", shortInfo.c_str() );
		//action2Input->GetActionInfo(ACTION_RELOAD_TTFS, info, shortInfo);
		//posY+=l_FontManager->DrawDefaultText(posX,posY,colWHITE,"- Press %s to reload the font", shortInfo.c_str() );
		//action2Input->GetActionInfo(ACTION_RELOAD_LANGUAGES, info, shortInfo);
		//posY+=l_FontManager->DrawDefaultText(posX,posY,colWHITE,"- Press %s to reload all xml language", shortInfo.c_str() );
		//action2Input->GetActionInfo(ACTION_RELOAD_ACTIONS, info, shortInfo);
		//posY+=l_FontManager->DrawDefaultText(posX,posY,colWHITE,"- Press %s to reload action xml", shortInfo.c_str() );
		if (inputManager->HasGamePad(IDV_GAMEPAD1) )
		{
   			posY+=l_FontManager->DrawDefaultText(posX,posY,colWHITE,"- GamePad1 is connected" );
		}
		else
		{
   			posY+=l_FontManager->DrawDefaultText(posX,posY,colWHITE,"- GamePad1 is not connected" );
		}

		if (inputManager->HasGamePad(IDV_GAMEPAD2) )
		{
   			posY+=l_FontManager->DrawDefaultText(posX,posY,colWHITE,"- GamePad2 is connected" );
		}
		else
		{
   			posY+=l_FontManager->DrawDefaultText(posX,posY,colWHITE,"- GamePad2 is not connected" );
		}

		if (inputManager->HasGamePad(IDV_GAMEPAD3) )
		{
   			posY+=l_FontManager->DrawDefaultText(posX,posY,colWHITE,"- GamePad3 is connected" );
		}
		else
		{
   			posY+=l_FontManager->DrawDefaultText(posX,posY,colWHITE,"- GamePad3 is not connected" );
		}

		if (inputManager->HasGamePad(IDV_GAMEPAD4) )
		{
   			posY+=l_FontManager->DrawDefaultText(posX,posY,colWHITE,"- GamePad4 is connected" );
		}
		else
		{
   			posY+=l_FontManager->DrawDefaultText(posX,posY,colWHITE,"- GamePad4 is not connected" );
		}
		posY+=l_FontManager->DrawDefaultText(posX,posY,colWHITE,"- FPS: %f", l_Fps );
		//posY+=l_FontManager->DrawDefaultText(posX,posY,colWHITE,"- Process name: %s", m_sProcessName.c_str() );
   		//posY+=l_FontManager->DrawDefaultText(posX,posY,colWHITE,"- Pointer mouse position: (%d,%d)", mousePos.x,mousePos.y);
    }
    else
    {
   		//Draw background quad2D
   		CColor quad2dColor(0.f,0.f,0.5f,0.7f);

   		std::string info, shortInfo;
   		//CActionToInput* action2Input = CORE->GetActionToInput();
   		//action2Input->GetActionInfo(ACTION_PROCESS_INFO, info, shortInfo);
   		std::string l_sInfo;
   		//baseUtils::FormatSrting(l_sInfo, "Press %s to view the Process Info (FPS: %f)", shortInfo.c_str(), fps);

   		uint32 w = l_FontManager->SizeX(l_sInfo.c_str());
   		uint32 h = l_FontManager->SizeY(l_sInfo.c_str());
   	 
   		CColor edgeColor = colBLACK;
   		edgeColor.SetAlpha(0.7f);
   		//l_GraphicsManager->DrawRectangle2D(m_PosRenderDebugInfo, w, h, quad2dColor, 1, 1, edgeColor);
		l_GraphicsManager->DrawRectangle2D(Vect2i(posX,posY), w, h, quad2dColor, 1, 1, edgeColor);
   		edgeColor = colWHITE;
   		//l_FontManager->DrawDefaultText(m_PosRenderDebugInfo.x,m_PosRenderDebugInfo.y, edgeColor, l_sInfo.c_str());
   		l_FontManager->DrawDefaultText(posX,posY, edgeColor, l_sInfo.c_str());
	}
	return posY;
}